{include file="public/head"/}
  
  <body>
    <div class="x-body">
        <form class="layui-form" action="{:url('admin/Lock/lockEdit')}" method="post" enctype="multipart/form-data">
            <input type="hidden" name="id"  value="{$info.id}" />

            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    <span class="x-red">*</span>所属小区:
                </label>
                <div class="layui-input-inline" style="width: 300px;">
                    <select name="community">
                        <option value=""><------选择小区------></option>
                        {foreach $community as $com}
                        <option value="{$com.id}" {if $info.community == $com.id} selected="selected" {/if}>{$com.name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>


            <div class="layui-form-item">
                <label for="lockname" class="layui-form-label">
                    <span class="x-red">*</span>门锁名称:
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="lockname" name="lockname" required="" lay-verify="required"
                    autocomplete="off" class="layui-input"  style="width: 300px;" value="{$info.lockname}">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="serial" class="layui-form-label">
                    <span class="x-red">*</span>序列号:
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="serial" name="serial" required="" lay-verify="required"
                    autocomplete="off" class="layui-input"  style="width: 300px;" value="{$info.serial}">
                </div>
            </div>

          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <button  class="layui-btn" lay-filter="add" lay-submit="">
                  修改门锁
              </button>
          </div>
      </form>
    </div>
    <script>
        layui.use(['form'], function() {
            var form = layui.form
            form.on('radio(xq)', function(f){
                var url = "{:url('admin/Lock/fetchdata')}"
                $.post(url, {locktype: f.value,community: community.value}, function(data) {
                $('#position').html("")
                var option = "<option value=''>选择所属部门</option>"
                $('#position').append(option)
                for (var i = 0; i < data.length; i++) {
                    option = "<option value='" + data[i] + "'>" + data[i] + "</option>"
                    $('#position').append(option)
                }
                form.render('select')
                })
            })
            form.on('radio(ld)', function(f){
                var url = "{:url('admin/Lock/fetchdata')}"
                $.post(url, {locktype: f.value,community: community.value}, function(data) {
                $('#position').html("")
                var option = "<option value=''>选择所属部门</option>"
                $('#position').append(option)
                for (var i = 0; i < data.length; i++) {
                    option = "<option value='" + data[i] + "'>" + data[i] + '幢' + "</option>"
                    $('#position').append(option)
                }
                form.render('select')
                })
            })
        })
    </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();</script>
  </body>

</html>